<?php if (!defined('THINK_PATH')) exit();?><!doctype html>
<html>
<head>
	<meta charset="utf-8">
	<!-- Set render engine for 360 browser -->
	<meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- HTML5 shim for IE8 support of HTML5 elements -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <![endif]-->

	<link href="/public/simpleboot/themes/<?php echo C('SP_ADMIN_STYLE');?>/theme.min.css?1" rel="stylesheet">
    <link href="/public/simpleboot/css/simplebootadmin.css?8" rel="stylesheet">
    <link href="/public/js/artDialog/skins/default.css" rel="stylesheet" />
	<link href="/public/css/other.css?<?php echo time(); ?>" rel="stylesheet" />
    <link href="/public/simpleboot/font-awesome/4.4.0/css/font-awesome.min.css"  rel="stylesheet" type="text/css">
    <style>
		form .input-order{margin-bottom: 0px;padding:3px;width:40px;}
		.table-actions{margin-top: 5px; margin-bottom: 5px;padding:0px;}
		.table-list{margin-bottom: 0px;}
	</style>
	<!--[if IE 7]>
	<link rel="stylesheet" href="/public/simpleboot/font-awesome/4.4.0/css/font-awesome-ie7.min.css">
	<![endif]-->
	<script type="text/javascript">
	//全局变量
	var GV = {
	    ROOT: "/",
	    WEB_ROOT: "/",
	    JS_ROOT: "public/js/",
	    APP:'<?php echo (MODULE_NAME); ?>'/*当前应用名*/
	};
	</script>
    <script src="/public/js/jquery.js"></script>
    <script src="/public/js/jquery.quicksearch.js"></script>
    <script src="/public/js/wind.js"></script>
    <script src="/public/simpleboot/bootstrap/js/bootstrap.min.js"></script>
    <script>
    	$(function(){
    		$("[data-toggle='tooltip']").tooltip();
    	});
    </script>
<?php if(APP_DEBUG): ?><style>
		#think_page_trace_open{
			z-index:9999;
		}
	</style><?php endif; ?>
<style type="text/css">
.pic-list li {
	margin-bottom: 5px;
}
</style>

</head>
<body>
	<div class="wrap js-check-wrap">
		<ul class="nav nav-tabs">
			<li class="active"><a href="<?php echo U('AdminCard/refund',array('id'=>empty($item['id'])?'':$item['id']));?>" target="_self">卡片退款</a></li>
		</ul>
		<form action="<?php echo U('AdminCard/refund_post');?>" method="post" class="form-horizontal js-ajax-forms" enctype="multipart/form-data" onsubmit="return ajax_sub();">
			<div class="row-fluid">
				<div class="span9">
					<table class="table table-bordered">
                        <?php if($user_model == 2): ?><tr>
							<th>账户余额</th>
                            <td><input type="text"  name="balance" id="balance" value="<?php echo ($logistics["balance"]); ?>" style="width: 400px" readonly> </td>
						</tr><?php endif; ?>
                        <tr>
                            <th>充值卡号<span class="form-required">*</span></th>
                            <td><input type="text" name="card_number" id="card_number" class="require number"  readonly  value="" style="width: 400px" placeholder="请输入绑定会员卡">
                                <input type="hidden" class="require" name="card_id"  id="card_id" value=""/>

                                <div class="div_quicksearch card_number_list">
                                    <input type="text" name="select_card_number" id="select_card_number" value="" placeholder="请输入绑定会员卡号"/>
                                    <ul class="card_number_list quicksearch">
                                        <?php if(is_array($card_list)): foreach($card_list as $key=>$citem): ?><li  onclick="quick_select('card_number','<?php echo ($citem["number"]); ?>','card_id','<?php echo ($citem["id"]); ?>')"><?php echo ($citem["number"]); ?></li><?php endforeach; endif; ?>
                                        <li class="no_card_number">没找到数据</li>
                                    </ul>
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <th>卡内余额</th>
                            <td><input type="text"  name="card_balance" id="card_balance" value="" style="width: 400px" readonly > </td>
                        </tr>
                        <tr>
                            <th>车牌号</th>
                            <td><input type="text"  name="car_code" id="car_code" value="" style="width: 400px" readonly > </td>
                        </tr>
                        <tr>
                            <th>会员</th>
                            <td><input type="text"  name="driver_name" id="driver_name" value="" style="width: 400px" readonly > </td>
                        </tr>
                        <tr>
                            <th>赠送</th>
                            <td><input type="text"  name="admin_card_give_price" id="admin_card_give_price" value="" style="width: 400px" readonly > </td>
                        </tr>
                        <tr>
                            <th>卡费</th>
                            <td><input type="text"  name="admin_card_active_price" id="admin_card_active_price" value="" style="width: 400px" readonly > </td>
                        </tr>
                        <tr>
                            <th>充值金额<span class="form-required">*</span></th>
                            <td><input type="text" class="require number" name="refund_price" id="refund_price" value="" style="width: 400px"  placeholder="请输入退款金额"> </td>
                        </tr>
                        <tr>
                            <th>描述</th>
                            <td><input type="text" name="desc" id="desc" value="" style="width: 400px" placeholder="请输入描述"> </td>
                        </tr>

                    </table>
				</div>

			</div>
			<div class="form-actions">
                <input type="hidden" name="id" value="<?php echo ($item["id"]); ?>"/>
				<button class="btn btn-primary js-ajax-submit" type="submit">提交</button>
				<a class="btn" href="<?php echo U('AdminCard/index');?>">返回</a>
			</div>
		</form>
	</div>
    <script type="text/javascript">
        var substatus = true;
        function ajax_sub(){
            if (substatus) {
                substatus = false;
                if (checkform() && confirm('是否确认进行退款操作？')) {
                    return true;
                }
            }else{
                substatus = true;
                return false;
            }
        }


        $(document).ready(function () {
            $("#select_card_number").quicksearch(".card_number_list li", {
                noResults: '.no_card_number_list'
            });
            $("#card_number,#select_card_number").click(function(){
                event.stopPropagation();
                $('.card_number_list').show();
                return false;
            });
            $("body").click(function(){
                $(".div_quicksearch").hide();
            });
            $("#select_card_number").keypress(function (e) { //这里给function一个事件参数命名为e，叫event也行，随意的，e就是IE窗口发生的事件。

                var key = e.which; //e.which是按键的值
                var is_select = false;
                if (key == 13) {
                    setTimeout(function(){
                        $(".card_number_list li").each(function(){
                           var disp = $(this).css("display");
                           if(disp != 'none'){
                               is_select = true;
                               $(this).click();
                                return false;
                           }
                        });
                        if(!is_select){
                            alert("该卡号不存在!");
                        }
                    },300);
                    return false;
                }
            });

            });
        function change_card_id(){
            var card_number = $("#card_number").val();

            $.ajax({url:"<?php echo U('AdminCard/ajax_get_card');?>",async:false,dataType:"json",data:"card_number="+card_number,type:"post",success:function(t){
                    if(t.code == 1){
                        var temp = t.data;
                        $("#card_balance").val(temp.balance);
                        $("#car_code").val(temp.car_code);
                        $("#driver_name").val(temp.driver_name);
                        $("#admin_card_give_price").val(temp.admin_card_give_price);
                        $("#admin_card_active_price").val(temp.admin_card_active_price);
                    }else{
                        alert(t.data);
                    }
            }});
        }
        function quick_select(id,val,id2,val2){
            $("#"+id).val(val);
            $("#"+id2).val(val2);
            change_card_id();
        }
    </script>
    <?php if(!empty($card)): ?><script>
            quick_select('card_number','<?php echo ($card["number"]); ?>','card_id','<?php echo ($card["id"]); ?>')
        </script><?php endif; ?>

	<script type="text/javascript" src="/public/js/common.js?5"></script>
	</body>
</html>